package cn.edu.ctbu.dp01.dao;

import cn.edu.ctbu.dp01.entity.Student;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.util.List;

public interface StudentRepository extends JpaRepository<Student, Integer> {
    public List<Student> findBySno(String sno);
//    按名字查询
    List<Student> findByNameLike(String name);
//    按名字和密码查询
    List<Student> findByNameAndSno(String name, String sno);
    @Query("SELECT s FROM tb_student s WHERE s.sno = (SELECT MAX(s2.sno) FROM tb_student s2)")
    Student findStudentWithMaxSno();
}
